﻿using System;

using enyo;

namespace com.RexToy
{
    public class AnglView : ConverterView
    {
        private new object[] components = new object[]{ 
            new {kind= ControlKind.BasicScroller, 
                components=new object[] {
                    new {kind=ControlKind.RowGroup, 
                        components= new object[]{
				            new {name= "d", richContent= false, kind = ControlKind.Input, onblur="blur",
                                    components=new object[]{
					                    new {className= "hint", content= enyo.Global._L("Degree")}
                                    }
                            },
                            new {name= "r", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components= new object[]{
					                    new {className= "hint", content= enyo.Global._L("Radian")}
				                    }
                            },
				            new {name= "g", richContent= false, kind= ControlKind.Input, onblur="blur", 
                                    components=new object []{
					                    new {className= "hint", content= enyo.Global._L("Gradian")}
				                   }
				            }				
			            }                    
		            }      
                }
            }
        };

        protected override void Create()
        {
            this.Inherited(Arguments.Value);

            this.units = new string[] { "d", "r", "g" };
            this.baseUnit = "d";

            this.fomular = new object();
            this.fomular["d->d"] = "d";
            this.fomular["d->r"] = "d/180*3.1416";
            this.fomular["r->d"] = "r*180/3.1416";
            this.fomular["d->g"] = "d/360*400";
            this.fomular["g->d"] = "g/400*360";
        }
    }
}
